<?php
require_once dirname(__FILE__).'/db_func.php';
class publics extends db{
	function publics(){
		$this->db_con();
	}
	//星期转换(转换成为汉字)
	function WeekTrans($t){
		switch($t){
			case 1:
				return "星期一";
				break;
			case 2:
				return "星期二";
				break;
			case 3:
				return "星期三";
				break;
			case 4:
				return "星期四";
				break;
			case 5:
				return "星期五";
				break;
			case 6:
				return "星期六";
				break;
			case 7:
				return "星期天";
				break;
			default:
				return "未知";
				break;
		}
	}
	//字符串转换成周次
	function WeeksTrans($weeks){
		$weeks = str_replace('9','',$weeks);
		$start = stripos($weeks,'1');
		$end = strrpos($weeks,'1');
		if($start ==  0 && $end == 0){
			return "未知";
		}else{
			$start += 1;
			$end += 1;
			return $start."~".$end."周";
		}
	}
	//获取时令
	function GetSchedule($t){
		switch($t){
			case 1:
				return "夏令时";
				break;
			case 2:
				return "冬令时";
				break;
			default:
				return "未知";
				break;
		}
	}
	//获取节次
	function GetTimeOrder($t){
		switch($t){
			case 0:
				return "早自习";
				break;
			case 1:
				return "第一大节";
				break;
			case 2:
				return "第二大节";
				break;
			case 3:
				return "第三大节";
				break;
			case 4:
				return "第四大节";
				break;
			case 5:
				return "晚修";
				break;
			default:
				return "未知";
				break;
		}
	}
	//获取性别
	function GetSex($sex){
		switch($sex){
			case 1:
				return "男";
				break;
			case 2:
				return "女";
				break;
			default:
				return "未知";
				break;
		}
	}
}
?>